package bTree.LeetCode;

public class 两数之和II输入有序数组 {
    public int[] twoSum(int[] numbers, int target) {
        int len=numbers.length;
        int left=0,right=len-1;
        while (true){
            int sum=numbers[left]+numbers[right];
            if(sum==target){
                return new int[]{left + 1, right + 1};
            } else if (sum>target) {
                right--;
            }else {
                left++;
            }
        }
    }
}